package com.xmtlxx.oms.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.xmtlxx.oms.domain.Task;
import com.xmtlxx.oms.domain.bo.CancelTaskBo;
import com.xmtlxx.oms.domain.bo.DisposalNotRegisterBo;
import com.xmtlxx.oms.domain.bo.DisposalTempStorageBo;
import com.xmtlxx.oms.domain.bo.TaskBo;
import com.xmtlxx.oms.domain.vo.DisposalApplyVo;
import com.xmtlxx.oms.domain.vo.DisposalProVo;
import com.xmtlxx.oms.domain.vo.RegionOverviewVo;
import com.xmtlxx.oms.domain.vo.TaskVo;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xmtlxx.common.annotation.DataColumn;
import com.xmtlxx.common.annotation.DataPermission;
import com.xmtlxx.common.core.mapper.BaseMapperPlus;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * 出入库订单Mapper接口
 *
 * @author xmtlxx
 * @date 2022-08-12
 */
public interface TaskMapper extends BaseMapperPlus<TaskMapper, Task, TaskVo> {
    /**
     * 根据条件分页查询出入库订单
     *
     * @param task 出入库订单
     * @return Page Task
     */
    @DataPermission({
        @DataColumn(key = "tenantName", value = "t.create_by"),
        @DataColumn(key = "deptName", value = "t.dept_id"),
        @DataColumn(key = "userName", value = "t.create_by")
    })
    Page<TaskVo> selectPageTaskList(@Param("page") Page<Task> page,@Param("task") TaskBo task);

    Page<TaskVo> selectPageTaskListWithOutLogin(@Param("page") Page<Task> page,@Param("task") TaskBo task);

    /**
     * 查询出入库订单列表
     *
     * @param task 出入库订单
     * @return 出入库订单集合
     */
    @DataPermission({
        @DataColumn(key = "tenantName", value = "t.create_by"),
        @DataColumn(key = "deptName", value = "t.dept_id"),
        @DataColumn(key = "userName", value = "t.create_by")
    })
    List<TaskVo> selectTaskList(@Param("task") TaskBo task);

    List<TaskVo> selectTaskVoList(@Param("task") TaskBo task);

    TaskVo selectTaskVoByID(String id);

    TaskVo selectTaskVoByTaskNo(@Param("task") TaskBo task);

    Task selectTaskEntity(String id);

    List<TaskVo> taskStatistics();

    List<TaskVo> outTaskStatistics(@Param("task") TaskBo task);

    Long selectCountAlls();

    int updateTask(@Param("task") Task task);

    Map<String,Object> countWeekWithTask(@Param("task") TaskBo task);

    Long selectCountTask(@Param("task") TaskBo task);

   List<RegionOverviewVo> getDisposalNotRegisterOverview();

    Page<DisposalNotRegisterBo> getDisposalNotRegisterList(Page<DisposalNotRegisterBo> page,
                                                        @Param(Constants.WRAPPER) Wrapper<Object> ew);

    List<DisposalNotRegisterBo> getDisposalNotRegisterList(@Param(Constants.WRAPPER) Wrapper<Object> ew);

    IPage<CancelTaskBo> cancelTaskList(Page<CancelTaskBo> page, @Param(Constants.WRAPPER) Wrapper<Task> ew);

    List<DisposalApplyVo> getDisposalApplyList(@Param("task") TaskBo task);

    DisposalProVo getDisposalProInfo(@Param("pno") String pno);

    @DataPermission({
            @DataColumn(key = "tenantName", value = "t.create_by"),
            @DataColumn(key = "deptName", value = "t.dept_id"),
            @DataColumn(key = "userName", value = "t.create_by")
    })
    Page<DisposalTempStorageBo> getTempStorageList(@Param("page") Page<DisposalTempStorageBo> page,
                                                   @Param("query") DisposalTempStorageBo bo);

    @DataPermission({
        @DataColumn(key = "tenantName", value = "t.create_by"),
        @DataColumn(key = "deptName", value = "t.dept_id"),
        @DataColumn(key = "userName", value = "t.create_by")
    })
    List<DisposalTempStorageBo> getTempStorageList(@Param("query") DisposalTempStorageBo bo);

}
